#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const ll N = 1e6 + 10, INF = 0x3f3f3f3f;

ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }

void solve()
{
    ll T;
    cin >> T;
    ll c1 = floor(sqrt(2 * T)), c2 = ceil(sqrt(2 * T));
    ll x1 = 2 * T + c1 * c1 - c1, y1 = 2 * c1;
    ll d1 = gcd(x1, y1);
    x1 /= d1;y1 /= d1;

    ll x2 = 2 * T + c2 * c2 - c2, y2 = 2 * c2;
    ll d2 = gcd(x2, y2);
    x2 /= d2;y2 /= d2;

    if (x1 * y2 < x2 * y1) cout << x1 << ' ' << y1 << '\n';
    else cout << x2 << ' ' << y2 << '\n';
}

signed main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll T = 1;
    cin >> T;
    for (ll i = 1;i <= T;i++) {
        solve();
    }
}